//
//  BuyView.m
//  WalletAPP
//
//  Created by 罗弟祥 on 2019/10/4.
//  Copyright © 2019 罗弟祥. All rights reserved.
//

#import "BuyView.h"
// 屏幕高度与宽度
#define screenW  [UIScreen mainScreen].bounds.size.width
#define screenH  [UIScreen mainScreen].bounds.size.height

@implementation BuyView

-(void)awakeFromNib{
    [super awakeFromNib];
    self.view1_w.constant = screenW;
    self.view2_w.constant = screenW;
    
   
}


- (IBAction)click:(UIButton *)sender {
    if (self.cellBlock) {
        self.cellBlock(0);
    }
}

- (IBAction)getBtnClick:(UIButton *)sender {
    if (self.cellBlock) {
        self.cellBlock(1);
    }
}
- (IBAction)enterBtnClick:(UIButton *)sender {
    if (self.cellBlock) {
        self.cellBlock(2);
    }
}
- (IBAction)copysBtnClick:(UIButton *)sender {
    if (self.cellBlock) {
        self.cellBlock(3);
    }
}

-(void)layoutSubviews{
    self.bView.layer.cornerRadius = 10;
    self.bView.clipsToBounds = YES;
    _bView.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    // 设置阴影偏移量
    _bView.layer.shadowOffset = CGSizeMake(5,5);
    // 设置阴影透明度
    _bView.layer.shadowOpacity = 1;
    // 设置阴影半径
    _bView.layer.shadowRadius = 5;
    _bView.clipsToBounds = NO;
    
    
    //    self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
    
    self.getBtn.layer.cornerRadius = 20;
    self.getBtn.clipsToBounds = YES;
    self.getBtn.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    // 设置阴影偏移量
    self.getBtn.layer.shadowOffset = CGSizeMake(5,5);
    // 设置阴影透明度
    self.getBtn.layer.shadowOpacity = .8;
    // 设置阴影半径
    self.getBtn.layer.shadowRadius = 3;
    self.getBtn.clipsToBounds = NO;
    
    
    self.enterBtn.layer.cornerRadius = 20;
    self.enterBtn.clipsToBounds = YES;
    self.enterBtn.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    // 设置阴影偏移量
    self.enterBtn.layer.shadowOffset = CGSizeMake(5,5);
    // 设置阴影透明度
    self.enterBtn.layer.shadowOpacity = .8;
    // 设置阴影半径
    self.enterBtn.layer.shadowRadius = 3;
    self.enterBtn.clipsToBounds = NO;
    
    
    self.bView1.layer.cornerRadius = 10;
    self.bView1.clipsToBounds = YES;
    _bView1.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    // 设置阴影偏移量
    _bView1.layer.shadowOffset = CGSizeMake(5,5);
    // 设置阴影透明度
    _bView1.layer.shadowOpacity = 1;
    // 设置阴影半径
    _bView1.layer.shadowRadius = 5;
    _bView1.clipsToBounds = NO;
    
    
    //    self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0];
    self.copysBtn.layer.cornerRadius = 20;
    self.copysBtn.clipsToBounds = YES;
    self.copysBtn.layer.shadowColor = [UIColor lightGrayColor].CGColor;
    // 设置阴影偏移量
    self.copysBtn.layer.shadowOffset = CGSizeMake(5,5);
    // 设置阴影透明度
    self.copysBtn.layer.shadowOpacity = .8;
    // 设置阴影半径
    self.copysBtn.layer.shadowRadius = 3;
    self.copysBtn.clipsToBounds = NO;
    
    
    UIBezierPath *maskPath = [UIBezierPath bezierPathWithRoundedRect:self.bounds byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(10, 10)];
    CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
    maskLayer.frame = self.bounds;
    maskLayer.path = maskPath.CGPath;
    
    maskLayer.shadowColor = [UIColor lightGrayColor].CGColor;
    // 设置阴影偏移量
    maskLayer.shadowOffset = CGSizeMake(-5,-5);
    // 设置阴影透明度
    maskLayer.shadowOpacity = .8;
    // 设置阴影半径
    maskLayer.shadowRadius = 3;
    self.clipsToBounds = NO;
    self.layer.mask = maskLayer;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
